﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2012/4/25 0:21:12
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sector7.Restaurant.EntityType;
using Sector7.Framework.Core;
using System.Collections;
using Sector7.Framework.DB;

namespace Sector7.Restaurant.DAO.OleDB
{
    /// <summary>
    /// 采购单数据访问对象
    /// </summary>
    public class PurchaseBillDAO : IPurchaseBillDAO
    {
        #region Public functions
        public int Create(RS_PurchaseBill bill)
        {
            using (DBHelper opt = new DBHelper())
            {
                string sql =
                    @"INSERT INTO RS_PurchaseBill
                            (BillId
                            ,OperatorId
                            ,CheckerId
                            ,Amount
                            ,OccurTime
                            ,Status
                            ,Remarks)
                        VALUES
                            (@BillId
                            ,@OperatorId
                            ,@CheckerId
                            ,@Amount
                            ,@OccurTime
                            ,@Status
                            ,@Remarks)";

                return opt.ExecuteNonQuery(
                    sql,
                    DBUtil.CreateSqlParameter(bill.BillId, "BillId"),
                    DBUtil.CreateSqlParameter(bill.OperatorId, "OperatorId"),
                    DBUtil.CreateSqlParameter(bill.CheckerId, "CheckerId"),
                    DBUtil.CreateSqlParameter(bill.Amount, "Amount"),
                    DBUtil.CreateSqlParameter(bill.OccurTime, "OccurTime"),
                    DBUtil.CreateSqlParameter(bill.Status, "Status"),
                    DBUtil.CreateSqlParameter(bill.Remarks, "Remarks"));
            }
        }
        #endregion
    }
}
